Skip to content

Conversation

@basnijholt
Copy link
Owner

Summary

  • Adds --standardize / -s flag to post-process and standardize ALL code fences, removing markdown-code-runner modifiers
  • Adds --no-execute / -n flag to skip code execution entirely
  • Updates docs_gen.py to use the new --standardize flag instead of a regex workaround

This provides a library-level CLI solution for compatibility with markdown processors like mkdocs and pandoc that don't understand the python markdown-code-runner syntax.

Usage

# Execute code AND standardize all code fences in output
markdown-code-runner --standardize input.md

# Only standardize, no code execution
markdown-code-runner --no-execute --standardize input.md

Test plan

  • Added tests for standardize_code_fences() function
  • Added tests for execute parameter in process_markdown() and update_markdown_file()
  • Added tests for standardize parameter in update_markdown_file()
  • All 36 tests pass
  • Linter passes

Closes #26

basnijholt and others added 6 commits January 14, 2026 07:16
The docs site renderer (Zensical/pymdownx) doesn't understand the
"python markdown-code-runner" syntax for code fence language identifiers.
This causes the fenced code blocks to be parsed as inline code instead
of proper code blocks, breaking the rendering.

Add a regex transformation in _transform_readme_links() to strip the
"markdown-code-runner" modifier when pulling content from README into
the docs templates.
This adds two new CLI flags to support standardizing code fences for
compatibility with markdown processors like mkdocs and pandoc:

- `--standardize` / `-s`: Post-process to standardize ALL code fences,
  removing 'markdown-code-runner' modifiers from language identifiers
- `--no-execute` / `-n`: Skip code execution entirely

These flags can be combined for different use cases:
- `--standardize`: Execute code AND standardize output
- `--no-execute --standardize`: Only standardize, no execution
- Default: Execute code with inline standardization of executed blocks

The docs_gen.py script now uses `--standardize` instead of the regex
workaround, making the solution available as a CLI option for all users.

Closes #26
Document the new CLI flags and Python API parameters:
- CLI: --standardize/-s and --no-execute/-n options
- Python API: execute and standardize parameters for update_markdown_file
- Python API: standardize_code_fences utility function
- Added usage examples for all new functionality
@basnijholt basnijholt merged commit fd06857 into main Jan 14, 2026
14 checks passed
@basnijholt basnijholt deleted the feature/standardize-flag branch January 14, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add backtick processing standardization for better compatibility with markdown processors

2 participants